from django.db import models

# Create your models here.
#商品分类表
class GoodsCategory(models.Model):
    cag_name=models.CharField(max_length=30)
    cag_css=models.CharField(max_length=20)
    cag_img=models.ImageField(upload_to='cag')

#商品表
class GoodsInfo(models.Model):
    goods_name=models.CharField(max_length=100)
    goods_price=models.DecimalField(max_digits=6, decimal_places=2)
    goods_desc=models.CharField(max_length=2000)
    goods_img=models.ImageField(upload_to='goods')
    goods_cag=models.ForeignKey('GoodsCategory',on_delete=models.CASCADE)

    def __str__(self):
        return self.goods_name
